<template>
    <div class="">
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>评测报告管理</el-breadcrumb-item>
                <el-breadcrumb-item>新建评测报告</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="plugins-tips">
            新建评测报告
        </div>
        <!--<ReportForm key="add" :formData="formData"-->
        <!--:apiUrl="apiUrl"-->
        <!--:successMessage="'评测报告创建成功'"-->
        <!--:init_content="init_content"-->
        <!--:init_display='init_display'-->
        <!--&gt;-->
        <!--</ReportForm>-->
        <el-form class="form-box" ref="reportForm" :model="formData" label-width="100px">
            <el-form-item label="项目类型" required prop="projectType">
                <el-select v-model="formData.projectType" filterable
                           placeholder="请选择发布账号">
                    <el-option
                        v-for="item in projectType"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="项目标题" required prop="title">
                <el-input v-model.trim="formData.title" placeholder="请输入项目标题"></el-input>
            </el-form-item>
            <el-form-item label="项目说明">
                <el-button type="primary" size="small" @click="addDesc()">添加
                </el-button>
            </el-form-item>
            <el-form-item v-for="item,i in formData.describe" :key="i">
                <el-input placeholder="请输入内容" v-model="item.value">
                    <el-button slot="append" icon="delete2" @click="delDesc(i)"></el-button>
                </el-input>
            </el-form-item>
            <el-form-item label="需求评审">
                <el-date-picker
                    v-model="formData.drXqps"
                    type="daterange"
                    placeholder="选择日期范围">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="FE">
                <el-input v-model.trim="formData.canyuren.fe" placeholder="请输入项目标题"></el-input>
            </el-form-item>
            <el-form-item label="RD">
                <el-input v-model.trim="formData.canyuren.rd" placeholder="请输入项目标题"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="submitForm( )">提交
                </el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
    import Api from '~util/api.js'

    export default {
        name: '',
        data() {
            return {
                projectType: [{
                    label: '未指定',
                    value: 1,
                }, {
                    label: '产品需求',
                    value: 2,
                }, {
                    label: '技术需求',
                    value: 3,
                }, {
                    label: '其他',
                    value: 4,
                }],
                formData: {
                    projectType: 3,
                    describe: [{value: ''}],
                    drXqps: '',
                    canyuren: {
                        fe: 'haohao,jlkjk',
                        qa: '',
                        pm: '',
                        rd: 'zhangyang123,zhaoying888'
                    }
                }
            };
        },
        computed: {},
        methods: {
            addDesc() {
                this.formData.describe.push({value: ''});
            },
            delDesc(index) {
                this.formData.describe.splice(index, 1);
            },
            async submitForm() {
                let fe = this.formData.canyuren.fe.split(',')
                let startDate = this.$utils.dateFormat(this.formData.drXqps[0], 'yyyy-MM-dd')
                let endDate = this.$utils.dateFormat(this.formData.drXqps[1], 'yyyy-MM-dd')
                console.log(this.formData, fe, startDate)
                // let res = await this.$_http(Api.cateSearchList, 'post', {
                //     param: JSON.stringify({})
                // })
            }
        },
        components: {}
    };
</script>

<style lang="sass" type="text/scss" scoped>
</style>
